import QtQuick 2.6
import Qt.labs.controls 1.0
import QtQuick.Layouts 1.1

import "../js/MyInfo.js" as MInfo
import "../lib"

Navigator {
    id: nav
    title: "收货地址"
    submitted: true
    submitText: "添加"
    contentHeight: Math.max(iHEIGHT * 12, height)

    onSubmit: contentArea.push("../qml/AddressCreateNavigator.qml")

    ListView {
        id: view
        anchors.fill: parent
        spacing: 3 * __factor__
        ButtonGroup {
             id: group
         }

        model: ListModel {
            ListElement {
                name: "范俊武"
                mobile: "15638682936"
                address: "浙江省杭州市"
                release: true
            }
            ListElement {
                name: "范俊武"
                mobile: "15638682936"
                address: "浙江省杭州市"
                release: false
            }
        }

        delegate:  View {
            width: view.width
            height: iHEIGHT * 3.8


            ColumnLayout {
                anchors.fill: parent
                anchors.margins: 9 * __factor__
                RowLayout {
                    Layout.fillWidth: true

                    Layout.fillHeight: true
                    Label {
                        text: model.name
                        Layout.alignment: Qt.AlignLeft
                        Layout.fillWidth: true
                    }


                    Label {
                        text: model.mobile
                        Layout.alignment: Qt.AlignLeft
                    }

                }

                Label {
                    text: model.address
                    color: "slategray"
                    Layout.preferredHeight: iHEIGHT * 0.7
                }
                Rectangle {
                    Layout.fillWidth: true
                    Layout.preferredHeight: 1
                    color: "forestgreen"
                }

                RowLayout {
                    RadioButton {
                        text: "默认地址"
                        checked: model.release
                        ButtonGroup.group: group
                        Layout.fillWidth: true
                    }

                    Button {
                        text: "编辑"
                    }
                    Button {
                        text: "删除"
                    }
                }
            }
        }



    }




}
